using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BaseForum.Model;
using BaseForum.Model;
using WebForum.App_Data;

namespace WebForum
{
    public partial class UserManager : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = (User)Session["user"];
            if (user == null || user.Type != BaseForum.Model.User.UserAdmin) Response.Redirect("Home.aspx");
            if (!IsPostBack)
            {

            }
        }

        protected void LinkButtonDelete_Click(object sender, EventArgs e)
        {
            LinkButton button = sender as LinkButton;
            GridViewRow row = (GridViewRow)button.NamingContainer;
            HiddenField hiddenField = (HiddenField)row.FindControl("HiddenFieldID");
            if (UserDataSource.Delete(Common.ParseInt32(hiddenField.Value)))
            {
                Common.Show("Delete User Sucess!", "UserManager.aspx");
            }
            Response.Redirect("UserManager.aspx");
        }
    }
}
